<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>Title</title>
    <script src="js/angular.js"></script>
</head>
<body ng-app="app" ng-controller="xmg">
<input type="text" ng-model="xx" ng-change="ch(xx)" ng-focus="foc()">
<span ng-show="is">'最大只能7位数，精确到小数点后2位'</span>
<span ng-show="i">请输入金额</span>
<button ng-click="bt()">提交</button>

<script>
    var app = angular.module('app', []);
    app.controller('xmg', ['$scope', function ($scope) {
        $scope.ch = function (val) {
            /*只能输入最大7位数，并且精确到小数点后2位*/
            var re = /^\d{0,7}(\.\d{1,2})?$/;
            if(!re.test(val)){
                $scope.is = true

            }else {
                $scope.is = false
            }
        }
        $scope.foc = function () {
            $scope.i = false
        }
        $scope.bt = function () {
            if(!$scope.xx){
                $scope.i = true
            }
        }
    }])
</script>
</body>
</html>